/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cxhd.lis.ctrl;

import com.cxhd.lis.model.LisSystemRes;
import com.cxhd.lis.model.LisSystemRoleRes;
import com.cxhd.lis.util.CacheTool;
import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Db;

/**
 *
 * @author 52461
 */
@ControllerBind(controllerKey = "/view/auth")
public class AuthCtrl extends Controller {

    private LisSystemRes lisAuth = new LisSystemRes();
    LisSystemRoleRes lisRoleRes= new LisSystemRoleRes();

    public void index() {
        render("/view/auth/authData.jsp");
    }

    public void saveAuth() {
        
        lisAuth.saveData(this);
        CacheTool.saveAllAuth(Db.find("select * from lis_system_res"));
        renderText("true");
    }

    public void getAuth() {
        renderJson(lisAuth.getData());
    }
    
    public void getMenu() {
        renderJson(lisAuth.getMenu());
    }
    
    public void deleteAuth() {
        lisAuth.deleteById(getPara("pk"));
        renderText("true");
    }
 
}
